"""
@Description : 返回数据的核心功能模块
@File        : helper.py
@Project     : EasyMath
@Time        : 2020/9/2 上午11:32
@Author      : Dexter Lien
@Software    : PyCharm
"""
import random


def plus_generate(max_result=20, num=10):
    """
    生成加法计算题
    :param max_result: 最大结果
    :param num: 生成数量
    :return: 
    """
    count = 0
    questions = []
    for _ in num:
        result = random.randint(0, max_result)
        a = random.randint(0, max_result)
        b = result - a
        if b >= 0 and not (b == 0 and a == 0):
            questions.append(dict(
                a=a,
                b=b,
                result=result
            ))
            

    return questions


if __name__ == '__main__':
    result = plus_generate()
    print(result)
